-
Notifications
You must be signed in to change notification settings - Fork 713
feat: add PSRAM-DMA flag + runtime API for ESP32-S2/S3; remove 16MHz heuristic #774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add PSRAM-DMA flag + runtime API for ESP32-S2/S3; remove 16MHz heuristic #774
Conversation
please think of a way to make this runtime configurable. The driver is used in Arduino, which uses a pre-compiled version of the driver and can not change sdkconfig on the fly |
Oh okay, wasn't aware of this limitation. What do you think of putting the capability behind a build flag thought, that would make the binary a bit smaller on devices which don't need it (which do usually have also very limited ROM). |
The driver runs only on ESP32, ESP32S2 and ESP32S3 which do not have such limitation. One option is to have a flag in the camera config (at the end), but preferably is to be set some other way, like a method that would set a flag in the driver, so it does not break existing code. |
Okay, will do, as soon as I'm back home. Since you've implemented it: Have you recently tested this mode? |
ef1c0da
to
ba2a8be
Compare
…heuristic Add a Kconfig switch (CONFIG_CAMERA_PSRAM_DMA) to enable camera to PSRAM DMA copy on ESP32-S2 and ESP32-S3 targets, in favor of removing the undocumented "set XCLK=16MHz to enable PSRAM DMA" heuristic. cam_hal.c: - Select psram_mode = true when CONFIG_CAMERA_PSRAM_DMA && target is S2/S3. - Otherwise psram_mode = false. - Log whether PSRAM DMA mode is enabled. Kconfig: - New bool CAMERA_PSRAM_DMA (default n) under Camera configuration. Runtime control: - New public API: - esp_camera_set_psram_mode(bool enable) - esp_camera_get_psram_mode(void) - esp_camera_reconfigure(const camera_config_t *cfg) README/test: - Remove stale 16MHz XCLK comments. - Add short note describing CONFIG_CAMERA_PSRAM_DMA.
ba2a8be
to
1484db7
Compare
success depends on different things. It does not work well for JPEG, but works fairly well for other modes. That is if XCLK is 16MHz... other sample clocks do not work well. You can see issues if PSRAM is otherwise heavily used too. Overall experimental feature |
Yeah I think I found the issue why it's not working for JPEGs: The test for the start of the byte marker for JPEGs does not work as far as I can tell, because the length field is not updated. So previous to #760 it would just try to read random bytes from the memory. Now it's just returning because there's nothing to read, because the length is zero. What needs to be done is, that if we get the first EOF for a completed DMA copy that we copy the first section from the PSRAM back into a temporary buffer in the SRAM, and give this temporary buffer to the SOI checker, so it can verify that there's a valid JPEG start. I'll provide an PR to do this as soon as I get time for that. |
Description
Add a Kconfig switch (CONFIG_CAMERA_PSRAM_DMA) to enable camera to PSRAM
DMA copy on ESP32-S2 and ESP32-S3 targets, in favor of removing the
undocumented "set XCLK=16MHz to enable PSRAM DMA" heuristic.
cam_hal.c:
Kconfig:
Runtime control:
README/test:
Checklist
Before submitting a Pull Request, please ensure the following: